<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>通知管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {
		layui.use(['laypage', 'form', 'table'], function(){
			var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
			form.render();
			var laypage = layui.laypage;
			laypage.render({elem: 'pageDiv',
				count: ${page.count}, //数据总数，从服务端得到
				curr:${page.pageNo},
				limit:30,
				layout: ['prev', 'page', 'next', 'count'],
				jump: function(obj, first){
				//obj包含了当前分页的所有参数，比如：
				// console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
				// console.log(obj.limit); //得到每页显示的条数
				//首次不执行
					if(!first){
				    	$("#firstPage").val(false);
				    	page(obj.curr,obj.limit);
					}
				}
			});
			var table = layui.table;
			table.init('oaNotifyTable',{limit:30});  
		}); 
	});
	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
        return false;
    }
	</script>
</head>
<body>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
			<li class="layui-this"><a
				href="${ctx}/oa/oaNotify/${oaNotify.self?'self':''}">通知列表</a></li>
			<c:if test="${!oaNotify.self}">
				<shiro:hasPermission name="oa:oaNotify:edit">
					<li><a href="${ctx}/oa/oaNotify/form">通知添加</a></li>
				</shiro:hasPermission>
			</c:if>
		</ul>
	</div>
		<form:form id="searchForm" modelAttribute="oaNotify"
			action="${ctx}/oa/oaNotify/${oaNotify.self?'self':''}" method="post"
			class="layui-form">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
			<blockquote class="layui-elem-quote quoteBox">
			<div class="layui-inline">
				<label class="layui-form-label">标题：</label>
				<div class="layui-input-block">
					<input id="title" name="title" maxlength="200" class="layui-input" />
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">类型：</label>
				<div class="layui-input-block">
					<select id="type" name="type" class="layui-input">
					<option value="" selected></option>
					<c:forEach items="${fns:getDictList('oa_notify_type')}" var="dict">
						<option value="${dict.value}">${dict.label}</option>
					</c:forEach>
					</select>
				</div>
			</div>
			<c:if test="${!requestScope.oaNotify.self}">
				<div class="layui-inline">
					<label class="layui-form-label">状态：</label>
					<div class="layui-input-block">
						<c:forEach items="${fns:getDictList('oa_notify_status')}" var="dict">
							<input type="radio" name="status" value="${dict.value}" title="${dict.label}" />
						</c:forEach>
					</div>
				</div>
			</c:if>
			<div class="layui-inline">
				<input id="btnSubmit" class="layui-btn search_btn" type="submit" value="查询" />
			</div>
			</blockquote>
		</form:form>
	<sys:message content="${message}" />
	<table id="contentTable" class="layui-table" lay-filter="oaNotifyTable">
		<thead>
			<tr>
				<th lay-data="{field:'title', minWidth:100}">标题</th>
				<th lay-data="{field:'type', minWidth:100}">类型</th>
				<th lay-data="{field:'status', minWidth:100}">状态</th>
				<th lay-data="{field:'check', minWidth:90}">查阅状态</th>
				<th lay-data="{field:'updataDate', minWidth:150}">更新时间</th>
				<c:if test="${!oaNotify.self}">
					<shiro:hasPermission name="oa:oaNotify:edit">
						<th lay-data="{field:'flag', minWidth:110, fixed:'right'}">操作</th>
					</shiro:hasPermission>
				</c:if>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="oaNotify">
				<tr>
					<td><a class="layui-blue"
						href="${ctx}/oa/oaNotify/${requestScope.oaNotify.self?'view':'form'}?id=${oaNotify.id}">
							${fns:abbr(oaNotify.title,50)} </a></td>
					<td>${fns:getDictLabel(oaNotify.type, 'oa_notify_type', '')}</td>
					<td>${fns:getDictLabel(oaNotify.status, 'oa_notify_status', '')}
					</td>
					<td><c:if test="${requestScope.oaNotify.self}">
						${fns:getDictLabel(oaNotify.readFlag, 'oa_notify_read', '')}
					</c:if> <c:if test="${!requestScope.oaNotify.self}">
						${oaNotify.readNum} / ${oaNotify.readNum + oaNotify.unReadNum}
					</c:if></td>
					<td><fmt:formatDate value="${oaNotify.updateDate}"
							pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<c:if test="${!requestScope.oaNotify.self}">
						<shiro:hasPermission name="oa:oaNotify:edit">
							<td><a class="layui-btn layui-btn-xs" lay-event="edit"
							 href="${ctx}/oa/oaNotify/form?id=${oaNotify.id}">修改</a>
								<a class="layui-btn layui-btn-danger layui-btn-xs"
								 href="${ctx}/oa/oaNotify/delete?id=${oaNotify.id}"
								onclick="return confirmx('确认要删除该通知吗？', this.href)">删除</a></td>
						</shiro:hasPermission>
					</c:if>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div id="pageDiv" class="pagination layui-elem-field layui-field-title">${page}</div>
</body>
</html>